const mongoose = require('mongoose')
const {host,post,name} = require('../config/ip')

module.exports = (success,error) => {
    mongoose.connect(`mongodb://${host}:${post}/${name}`)

    mongoose.connection.once('open',()=>{
        console.log('数据库连接成功');
        success()
    })

    mongoose.connection.on('error',()=>{
        error()
    })
}